﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SecurityApi.DataAccess;

namespace SecurityApi.UnitTest
{
    [TestClass]
    public class EnterpriseUnitTest
    {
        [TestMethod]
        public void GetAllEnterprisesTest()
        {
            SecurityApi.DataAccess.EnterpriseRepository repository = new SecurityApi.DataAccess.EnterpriseRepository();

            IQueryable<SecurityApi.DataAccess.Enterprise> query = repository.GetAll();
            List<SecurityApi.DataAccess.Enterprise> list = query.ToList();
            foreach (SecurityApi.DataAccess.Enterprise e in list)
            {
                Debug.WriteLine(e.Name);
            }
        }

        [TestMethod]
        public void GetEnterpriseByIdTest()
        {
            SecurityApi.DataAccess.EnterpriseRepository repository = new SecurityApi.DataAccess.EnterpriseRepository();
            int enterpriseId = 1;
            SecurityApi.Model.Enterprise enterprise = repository.GetEnterpriseById(enterpriseId);
            Debug.WriteLine(enterprise.Name);
            //foreach (Application app in enterprise.Applications)
            //{
            //    Debug.WriteLine(app.Name);
            //}
        }

    }
}
